package com.xyhy.core.web.model.wrapper;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;

@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
@ApiModel("字段错误")
public class FieldError {
  @ApiModelProperty("字段")
  private String field;

  private String code;

  private String message;

  public FieldError(org.springframework.validation.FieldError fieldError) {
    this.field = fieldError.getField();
    this.code = fieldError.getCode();
    this.message = fieldError.getDefaultMessage();
  }

}
